package com.web.logindemo.controller;

import com.web.logindemo.common.annotation.DataSource;
import com.web.logindemo.common.annotation.Log;
import com.web.logindemo.common.annotation.RateLimiter;
import com.web.logindemo.common.enums.BusinessType;
import com.web.logindemo.common.enums.DataSourceType;
import com.web.logindemo.common.enums.OperatorType;
import com.web.logindemo.domain.SysLogininfor;
import com.web.logindemo.domain.page.TableDataInfo;
import com.web.logindemo.service.ISysLogininforService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * 系统访问记录
 */
@RestController
@RequestMapping("/monitor/logininfor")
public class SysLogininforController extends BaseController {

    @Autowired
    private ISysLogininforService logininforService;

    @DataSource(value = DataSourceType.SLAVE)
    @RateLimiter(time = 10, count = 10)
    @Log(title = "操作日志", businessType = BusinessType.SELECT)
    @GetMapping("/list")
    @PreAuthorize("@ss.hasPermi('monitor:login:list')")
    public TableDataInfo list(SysLogininfor logininfor){
        startPage();
        List<SysLogininfor> list = logininforService.selectLogininforList(logininfor);
        return getDataTable(list);
    }
}
